home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
workbench
/
blankery
/
bserverdir
/
sources
/
server
/
commodity.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-12-02
|
2KB
|
117 lines
#include <exec/types.h>
#include <exec/memory.h>
#include <libraries/commodities.h>
#include <libraries/gadtools.h>
#include <dos/dos.h>
#include <workbench/startup.h>
#include <clib/exec_protos.h>
#include <clib/alib_protos.h>
#include <clib/commodities_protos.h>
#include <clib/gadtools_protos.h>
#include <clib/dos_protos.h>
#include <clib/icon_protos.h>
#include <stdio.h>
#include <string.h>
#include "/include/server.h"
extern BOOL PopUp, CommodityActive, RandomClient, StayCool;
extern UWORD delaySecs, timeElapsed;
extern struct Gadget *active_gdg;
extern struct Window *window;
extern BOOL PopUpWindow( void );
extern void ShutWindow( void );
/******************
* *
* GENERAL UTILITY *
* *
******************/
void ClearPendingMessages( struct MsgPort *mport )
{
struct Message *msg;
while ( msg = GetMsg( mport ) )
ReplyMsg( msg );
}
/******************
* *
* COMMODITY STUFF *
* *
******************/
#define EVT_HOTKEY 1L
struct Library *CxBase, *IconBase;
struct MsgPort *broker_mp;
CxObj *broker, *filter, *sender, *translate;
ULONG CXSignal;
struct NewBroker newbroker = {
NB_VERSION,
PROGRAMNAME,
PROGRAMNAME" "PROGRAMVERSION" © 1994 by Stefano Reksten of 3AM",
"Simple server for screen blankers",
NBU_UNIQUE | NBU_NOTIFY,
COF_SHOW_HIDE, 0, 0, 0 };
UBYTE brokerPri = 0;
char hotkey[40] = "lalt b";
void HandleCxMessages( void )
{
CxMsg *msg;
ULONG msgid, msgtype;
while(msg = (CxMsg *)GetMsg(broker_mp))
{
msgid = CxMsgID(msg);
msgtype = CxMsgType(msg);
ReplyMsg((struct Message *)msg);
switch(msgtype)
{
case CXM_IEVENT:
if ( msgid == EVT_HOTKEY )
PopUpWindow();
break;
case CXM_COMMAND:
switch(msgid)
{
case CXCMD_DISABLE:
ActivateCxObj(broker, 0L);
break;
case CXCMD_ENABLE:
ActivateCxObj(broker, 1L);
break;
case CXCMD_KILL:
StayCool = FALSE;
break;
case CXCMD_UNIQUE:
PopUpWindow();
break;
case CXCMD_APPEAR:
PopUpWindow();
break;
case CXCMD_DISAPPEAR:
ShutWindow();
break;
}
break;
default:
break;
}
}
}